package com.fcl.mylibrary.banner;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fang on 2016/8/26.
 * 配置项
 */
public class MyPagerConfig<T> {

    /**
     * 点击的回调接口
     */
    private MyPageListener myPageListener;

    /**
     * 数据类型
     */
    private DataType dataType;

    /**
     * 图片的填充类型
     */
    private ImageFitType imageFitType;

    /**
     * 图片的来源类型
     */
    private ImageSrc imageSrcType;

    /**
     * 待填充的数据源
     */
    private List<T> showDatas = new ArrayList<>();

    public MyPageListener getMyPageListener() {
        return myPageListener;
    }

    public void setMyPageListener(MyPageListener myPageListener) {
        this.myPageListener = myPageListener;
    }

    public DataType getDataType() {
        return dataType;
    }

    public void setDataType(DataType dataType) {
        this.dataType = dataType;
    }

    public ImageFitType getImageFitType() {
        return imageFitType;
    }

    public void setImageFitType(ImageFitType imageFitType) {
        this.imageFitType = imageFitType;
    }

    public ImageSrc getImageSrcType() {
        return imageSrcType;
    }

    public void setImageSrcType(ImageSrc imageSrcType) {
        this.imageSrcType = imageSrcType;
    }

    public List<T> getShowDatas() {
        return showDatas;
    }

    public void setShowDatas(List<T> showDatas) {
        this.showDatas = showDatas;
    }

    public static class Builder<T> {

        private MyPagerConfig config;

        public Builder() {
            if (config == null) {
                config = new MyPagerConfig();
            }
        }

        public Builder setMyPageListener(MyPageListener listener) {
            config.setMyPageListener(listener);
            return this;
        }

        public Builder setImageFitType(ImageFitType type) {
            config.setImageFitType(type);
            return this;
        }

        public Builder setImageSrcType(ImageSrc type) {
            config.setImageSrcType(type);
            return this;
        }

        public Builder setDataType(DataType type) {
            config.setDataType(type);
            return this;
        }

        public Builder setShowDatas(List<T> datas) {
            config.setShowDatas(datas);
            return this;
        }

        public MyPagerConfig<T> create() {
            return config;
        }

    }
}
